/* eslint-disable eqeqeq */
import React, { useState, useEffect } from "react";
import { getInfo } from "../components/xz-mine/API/LoginAPI";
import { List } from "antd-mobile";
import Chfn from "../components/xz-mine/Chfn";
import Header from "../components/Header";


export default function Personal() {
  const [obj, setobj]: any = useState({});

  const handleInfo = async () => {
    let res = await getInfo({});
    // console.log(res);
    if (res.data.code == 200) {
      setobj(res.data.user);
    }
  };

  useEffect(() => {
    handleInfo();
  }, []);

  return (
    <>
    <Header title='个人信息'></Header>
    <div className="boss xz-content ">
      <List>
        <List.Item  extra={obj.userName}>
          用户名
        </List.Item>
        <List.Item extra={obj.nickName}>
          用户昵称
        </List.Item>
        <List.Item  extra={obj.sex == 0 ? " 男" : "女"}>
          用户性别
        </List.Item>
        <List.Item  extra={obj.userId}>
          用户ID
        </List.Item>
        <List.Item  extra={obj.phonenumber}>
          手机号
        </List.Item>
        <List.Item  extra={obj.idCard?.replace(/^(\d{2})\d+(\d{4})$/, '$1****$2')}>
          身份证号
        </List.Item>
        <List.Item  extra={obj.email}>
          邮箱
        </List.Item>
        <List.Item  extra={obj.balance}>
          用户积分
        </List.Item>
      </List>
      <Chfn></Chfn>
    </div>
    </>
  );
}
